// 文件流下载通用下载方法
/**
 * @author zjq
 * @description 通用下载方法
 * @param fileData   文件流
 * @param filename   文件名
 */
export const downloadFileStream = (fileData, filename) => {
  const blob = new Blob([fileData], { type: fileData.type });
  console.log(blob, "blob");
  if ("download" in document.createElement("a")) {
    const link = document.createElement("a");
    link.download = filename;
    link.style.display = "none";
    link.href = URL.createObjectURL(blob);
    document.body.appendChild(link);
    link.click();
    URL.revokeObjectURL(link.href);
    document.body.removeChild(link);
  } else {
    navigator.msSaveBlob(blob, filename);
  }
};
export default downloadFileStream;
